import {hrAjax as proFetch} from 'src/hrpub/common/utils/utils';

export default function resetFormInfo() {
    const {form} = this.props;
    const disableField = {psnname: true, permanentres: true, idtype: true, id: true, sex: true, birthday: true};
    const enableField = {psnname: false, permanentres: false, idtype: false, id: false, sex: false, birthday: false};
    let postData = {
        model: form.getAllFormValue('blackcard')
    };

    return proFetch({
        url: '/nccloud/hrhi/blacklist/BlackListPsnSelAction.do',
        body: postData,
    })
        .then((res) => {
            if (res.success) {
                form.setAllFormValue({'blackcard': res.data.blackcard});
                form.setFormItemsDisabled('blackcard', res.data.blackcard.rows[0].values.psncode.value ? disableField : enableField)
            }
        });
}
